
let h2 = document.querySelector("#time");

let hours = document.querySelector("#hours");
let minutes = document.querySelector("#minutes");
let seconds = document.querySelector("#seconds");

let startBtn = document.querySelector("#start");
let endBtn = document.querySelector("#end");

let index;
function start() {
    startBtn.disabled = true;
    endBtn.disabled = false;
    index = setInterval(() => {
        // h2.innerText = new Date().toLocaleString();
        let now = new Date();
        hours.innerText = now.getHours();
        minutes.innerText = now.getMinutes() < 10 ? "0" + now.getMinutes() : now.getMinutes();
        seconds.innerText = now.getSeconds() < 10 ? "0" + now.getSeconds() : now.getSeconds();
    }, 980);
}

function end() {
    startBtn.disabled = false;
    endBtn.disabled = true;
    clearInterval(index);
}